/**
 * Created with Vim7.3 ubuntu12.04
 * @fileOverview : 
 * @author : Lyle <lylechen2014@gmial.com>
 * @since : 2014-09-15 14:14:23
 * @filename : static/logic/nmm/src/views/upgrade.js
 * @version : 
 * @description : 
 */

define(function(require, exports, module){
    var upgradeView,nav='upgrade',
        mId = 'upgrade',reRender = false,menuName = 'upgrade',
        panel = require('{component}panel/zepto.panel'),
        imglazyload = require('{component}imglazyload/zepto.imglazyload');

    upgradeView = Backbone.View.extend({

        el: 'body',

        template: '',
        templateN: '',

        initialize: function () {
            this.template   = _.template(require('{view}upgrade.tpl'));
            this.templateN  = _.template(require('{view}userNav.tpl'));
        },

        events: {},

        render: function (obj) {
            if (!share.checkPermission(true)){return;};
            share.reRender(reRender,mId); 
            if ($('#'+mId).length < 1) {
                $('body').append(this.template(lang));
                this.bindEvt();
            } else {
                $('#'+mId).css('display','block');
            }
            share.panel(panel,this.templateN,mId,menuName);
        },

        bindEvt : function() {
            var tthis = this,dom = $('#'+mId);

            dom.find('.left').on('tap',function(e){
                e.stopPropagation();
                if (panel.info.state == 'hidden') {
                    panel.show();
                } else {
                    panel.hidden(); 
                }
            });
            dom.find('.buy').on('tap',function(){
                var type = $(this).attr('type'); 
                window.location.href = '#payment/whole/custom'+type;
            });
 
        }
    });

    module.exports = upgradeView;
});
